package finance.asset.bank.controller;

import java.util.ArrayList;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import finance.asset.bank.domain.BankCust;
import finance.asset.bank.service.BankServiceImpl;

@Controller
@RequestMapping("/bank")
public class BankController {
	@Autowired
	private BankServiceImpl bankService;
	
	@RequestMapping("/addaccount.do")//계좌 추가 , ajax 처리
	@ResponseBody
	public ArrayList insertAccount(BankCust bankCust){
		System.out.println(bankCust);
		bankService.insertAccount(bankCust);
		ArrayList list = new ArrayList();
		list.add("계좌를 추가했습니다.");
		return list;
	}
	
	@RequestMapping("/removeaccount.do")//계좌 삭제 , ajax 처리
	@ResponseBody
	public ArrayList deleteAccount(String account , ModelMap map){
		ArrayList list = new ArrayList();
		list.add("계좌를 삭제했습니다.");
		return list;
	}
	
	@RequestMapping("/list.do")//계좌 모든 리스트
	public String selectAllAccount(ModelMap map){
		
		return "/bank/bankmain.jsp";
	}
	
	@RequestMapping("/account.do")//클릭한 계좌 상세정보
	public String selectAccount(String custId , String account ,ModelMap map){
		
		return "/bank/bank.jsp";
	}
}
